import { initWindowFn } from './initWindowInfoObj'
import { changeScale } from './changeScale'
// 防抖调用
const antiShake = (delay, callback) => {
    let time = null;
    return (windowInfoObj) => {
        if (time) {
            clearTimeout(time)
        }
        time = setTimeout(() => {
            callback(windowInfoObj)
        }, delay)
    }
}
// 防抖初始化
let antiShakeInit = antiShake(500, (windowInfoObj) => {
    initWindowFn(windowInfoObj)
    changeScale(windowInfoObj)
})
export const windowChange = (windowInfoObj) => {
    window.addEventListener('resize', (e) => {
        antiShakeInit(windowInfoObj)
    });
}
